Skip to content

fix: use ANTHROPIC_API_KEY for opencode agent in gh-action#383

Merged
wesm merged 1 commit intomainfrom
opencode-gh-action
Feb 26, 2026
Merged

fix: use ANTHROPIC_API_KEY for opencode agent in gh-action#383
wesm merged 1 commit intomainfrom
opencode-gh-action

Conversation

@wesm
Copy link
Collaborator

@wesm wesm commented Feb 26, 2026

Summary

  • OpenCode is a multi-provider tool with no single API key. AgentEnvVar() previously fell through to the default case returning OPENAI_API_KEY, which was confusing and misleading.
  • Default to ANTHROPIC_API_KEY for the opencode agent, matching OpenCode's own GitHub Actions docs.
  • Add guidance in the generated workflow preamble and CLI next-steps output telling users to swap the secret if they use a different model provider (e.g., OPENAI_API_KEY, GOOGLE_API_KEY).

Closes #325

Test plan

  • TestAgentEnvVar/opencode — verifies opencode maps to ANTHROPIC_API_KEY
  • TestGenerate/opencode_uses_ANTHROPIC_API_KEY — verifies workflow output contains ANTHROPIC_API_KEY and the "different model provider" guidance
  • TestGenerate/dedupes_env_vars — claude-code + opencode share a key, deduped to one entry
  • TestAgentSecrets/codex_and_opencode_have_separate_keys — codex and opencode no longer incorrectly dedupe
  • TestGhActionCmd — all CLI subtest variants pass
  • Full go test -race ./internal/ghaction/... ./cmd/roborev/...

🤖 Generated with Claude Code

OpenCode is a multi-provider tool with no single API key of its own.
It previously fell through to the default OPENAI_API_KEY, which was
confusing. Default to ANTHROPIC_API_KEY (matching OpenCode's own
GitHub Actions docs) and add a note in the workflow preamble telling
users to swap the secret if they use a different model provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@roborev-ci
Copy link

roborev-ci bot commented Feb 26, 2026

roborev: Combined Review (8037ad4)

Verdict: Clean.

All agents agree the code is clean.


Synthesized from 4 reviews (agents: codex, gemini | types: default, security)

@wesm wesm merged commit 1851e51 into main Feb 26, 2026
8 checks passed
@wesm wesm deleted the opencode-gh-action branch February 26, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roborev init gh-action for OpenCode creates references to confusing/misnamed API_KEY constant

1 participant